package cn.itcast.utils;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateControl implements Converter<String,Date> {
    public Date convert(String source) {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        Date parse=null;
        try {
             parse = sdf.parse(source);
        } catch (ParseException e) {
            e.printStackTrace();
        }


        return parse;
    }
}
